package com.tebiecloud.base.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tebiecloud.base.client.constants.BaseConstants;
import com.tebiecloud.base.client.model.entity.GatewayRoute;
import com.tebiecloud.base.server.mapper.GatewayRouteMapper;
import com.tebiecloud.base.server.service.GatewayRouteService;
import com.tebiecloud.common.mybatis.base.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 开放网关-路由 服务实现类
 * @author tebie
 * @date 2019-08-01
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class GatewayRouteServiceImpl extends BaseServiceImpl<GatewayRouteMapper, GatewayRoute> implements GatewayRouteService {

    /**
     * 查询可用路由列表
     * @return
     */
    @Override
    public List<GatewayRoute> findRouteList() {
        QueryWrapper<GatewayRoute> queryWrapper = new QueryWrapper();
        queryWrapper.lambda().eq(GatewayRoute::getStatus, BaseConstants.ENABLED);
        List<GatewayRoute> list = list(queryWrapper);
        return list;
    }

}
